
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
import { CommonEntity } from "./common.entity";
import { GradeEntity } from './grade.entity';
import { StudentEntity } from './user/student.entity';
import { GroupEntity } from './group.entity';
@Entity('major', {
	comment: '专业信息表',
	schema: "public"
})
export class MajorEntity extends CommonEntity {
	@PrimaryGeneratedColumn({ type: 'integer', name: 'major_id', comment: '专业ID' })
	majorId: number;

	@Column({ type: 'integer', name: 'grade_id', default: null, comment: '年级ID' })
	gradeId: number;

	@Column({ type: 'integer', name: 'group_id', default: null, comment: '分组ID' })
	groupId: number;

	@Column({ type: 'character varying', name: 'major_name', default: null, comment: '专业名称' })
	majorName: string;

	@Column({ type: 'character varying', name: 'grade_major_name', default: null, comment: '年级专业名称' })
	gradeMajorName: string;

	@Column({ type: 'character', name: 'group_flag', default: '0', comment: '状态（0未分组 1已分组）' })
	groupFlag: string;

	@Column({ type: 'character varying', name: 'remark', default: null, comment: '备注' })
	remark: string;

	@Column({ type: 'character', name: 'status', default: '0', comment: '状态（0正常 1停用）' })
	status: string;

	@Column({ type: 'character', name: 'del_flag', default: '0', comment: '删除标志（0代表存在 1代表删除）' })
	delFlag: string;
	@ManyToOne(() => GradeEntity, (gradeEntity) => gradeEntity.children)
	@JoinColumn({ name: 'grade_id' })
	grade: GradeEntity;
	@OneToMany(() => StudentEntity, (studentEntity) => studentEntity.major)
	students: StudentEntity[];
	@ManyToOne(() => GroupEntity, (groupEntity) => groupEntity.majors)
	@JoinColumn({ name: 'group_id' })
	group: GroupEntity;
}
